#!/bin/sh
CUR_DIR=$(cd "$(dirname "$0")"; pwd)
start=$(date +%s)
source ${CUR_DIR}/non_partitions_files/mileage_sofar.config
sqoop export \
-D mapred.job.queue.name=spark -D sqoop.export.records.per.statement=100 -D sqoop.export.statements.per.transaction=100 \
--connect ${jdbc_url} \
--username ${username} \
--password ${password} \
--update-key ${update_key} \
--update-mode allowinsert \
--table ${table_name} \
--fields-terminated-by '\t' \
--hcatalog-database ${hive_database} \
--hcatalog-table ${hive_table} \
--columns ${columns}

if [ $? -ne 0 ] ; then
    echo "${f}执行失败..."
else
    echo "${f}执行成功..."
fi

end=$(date +%s)
echo "ENDTIME：`date '+%Y%m%d-%H%M%S'`"  
time=$(( $end - $start ))
echo "DURATION(S): $time"
